const express = require('express');
const router = express.Router();
const userController = require('../controllers/userController');
const { authenticate, requireAdmin, checkUserAccess } = require('../middleware/auth');

// 获取用户列表（管理员）
router.get('/', authenticate, requireAdmin, userController.getUsers);

// 获取单个用户信息
router.get('/:id', authenticate, checkUserAccess, userController.getUserById);

// 更新用户信息
router.put('/:id', authenticate, checkUserAccess, userController.updateUser);

// 获取用户余额
router.get('/:id/balance', authenticate, checkUserAccess, userController.getUserBalance);

module.exports = router;
